#include "stdafx.h"
#include "PasswordDlg.h"

namespace SOUI {

PasswordDlg::PasswordDlg(SStringT strTitle, bool bPassword):SHostDialog(_T("LAYOUT:PasswordDlg"))
{
	m_strTitle = strTitle;
	m_bKeepPassword = FALSE;
	m_bPassword = bPassword;
}


PasswordDlg::~PasswordDlg()
{

}

void PasswordDlg::EndDialog(INT_PTR nResult)
{
	switch (nResult)
	{
	case IDOK:
	{
		m_strPassWord = FindChildByName2<SEdit>("edit_password")->GetWindowText();
		//m_bKeepPassword = FindChildByName2<SCheckBox>("check_selected")->IsChecked();
	}
	break;
	default:
		break;
	}
	__super::EndDialog(nResult);
}
void PasswordDlg::OnClose()
{
	EndDialog(IDCANCEL);
}

BOOL PasswordDlg::OnInitDialog(HWND wndFocus, LPARAM lInitParam)
{
	SStatic *pTitle = FindChildByName2<SStatic>("title");
	pTitle->SetWindowText(m_strTitle);
	FindChildByName2<SStatic>("warning")->SetVisible(m_bPassword);
	return 0;
}


SStringT PasswordDlg::GetPassWord()
{
	return m_strPassWord;
}

BOOL PasswordDlg::GetIsKeepPassword()
{
	return m_bKeepPassword;
}

}
